<template>
  <page-container :shownav="true" :isback="true" navtitle="活动详情" :istabbox="false">
    <view class="content_container">
      <view class="content">
        <!--活动信息-->
        <DoingSDetailCard class="doings_card" :detailData="detailData">
        </DoingSDetailCard>
        <!--内容-->
        <view class="content_pot">
          <view class="title_box">
            <span>内容</span>
          </view>
          <view class="content_box">
            <!--这里有点问题能正常显示但是有报错-->
            <u-parse :content="detailData.activityDesc">{{ content }}</u-parse>
          </view>
        </view>
        <!--参与名单-->
        <TakeParPerson class="takePart_pot" :tastPartData="detailData"></TakeParPerson>
        <!--活动现场-->
        <view v-if="detailData.showDynamic==1">
          <SceneDoings class="sceneDoings_pot" :sceneData="detailData"></SceneDoings>
        </view>
      </view>
      <!--      -->
      <!--发表感言按钮  detailData.allowDynamic==1-->
      <view :class="detailData.allowDynamic!=1 ?['success-bt-container', 'disabled'] : 'success-bt-container' "
            class="success-bt-container">
        <view @click="signUp" class="bt-item go-back-bt">发表活动感言</view>
      </view>
    </view>
  </page-container>
</template>

<script>
import DoingSDetailCard from "@/components/doingsDetailCard"
import TakeParPerson from "@/components/takeParPerson/index.vue";
import SceneDoings from "@/components/sceneDoings/index.vue";
import {getQueryHeaders, requestGet} from "@/util/means/request";
import {baseMixins} from "@/util/baseMixins";
import {testimonialsPage} from "@/util/publicConfig";
import {getFileAccessHttpUrl} from "@/util/fileUtil";

export default {
  name: "index",
  mixins: [baseMixins],
  components: {
    DoingSDetailCard,
    TakeParPerson,
    SceneDoings
  },
  data() {
    return {
      activityId: '', //活动id
      detailData: {}, //用于接收接口返回的详情信息
      testimonialsPage,
    }
  },
  //页面跳转后会调用此方法
  onLoad(params) {
    this.activityId = params.id
    this.getDetailsData(params.id);
  },

  methods: {
    signUp() {
      if (this.detailData.allowDynamic != 1) {
        return
      }
      this.goSubPage(`${testimonialsPage}?activityId=${activityId}`)
    },
    getDetailsData(activityId) {
      let params = {
        activityId: activityId,
      }
      requestGet({url: "/activity/getActivityDetail", data: params, header: getQueryHeaders()}).then(res => {
        this.detailData = res;
        // debugger
        // console.log(this.detailData);
        this.detailData.userAvatar = res.userAvatar != null && res.userAvatar !== '' ? getFileAccessHttpUrl(res.userAvatar) : '/static/img/mine/defalut-avatar.png';
      }, err => {
        console.log(err, '==============')
      })

    },


  }
}
</script>

<style scoped lang="scss">
.content_container {
  background-color: #F5F5F5;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding-left: 30rpx;
  padding-top: 30rpx;
  padding-right: 30rpx;
  box-sizing: border-box;

  .content {
    height: calc(100% - 120rpx);
    width: 100%;
    overflow: auto;

    .doings_card {
      width: 100%;
      background-color: #FFFFFF;
      margin-bottom: 30rpx;
      border-radius: 20rpx;
    }

    .content_pot {
      width: 100%;
      //height: 432rpx;
      background-color: #FFFFFF;
      margin-bottom: 30rpx;
      border-radius: 20rpx;
      box-sizing: border-box;
      padding-left: 30rpx;
      padding-right: 16rpx;

      .title_box {
        width: 100%;
        height: 100rpx;
        //background-color: #BBFFAA;
        display: flex;
        justify-content: start;
        align-items: center;
        font-size: 30rpx;
        color: #222222;
        font-weight: 600;
      }

      .content_box {
        width: 100%;
        //height: calc(432rpx - 100rpx);
        padding-bottom: 30rpx;
        //background-color: pink;
        overflow: hidden;
        font-size: 30rpx;
        color: #707070;

      }

    }

    .takePart_pot {
      width: 100%;
      //height: 582rpx;
      padding-bottom: 30rpx;
      background-color: #FFFFFF;
      margin-bottom: 30rpx;
      border-radius: 20rpx;
    }

    .sceneDoings_pot {
      width: 100%;
      padding-bottom: 30rpx;
      background-color: #FFFFFF;
      margin-bottom: 30rpx;
      border-radius: 20rpx;
    }
  }


  .success-bt-container {
    height: 120rpx;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;

    &.disabled {
      .bt-item {
        background: #DCDCDC;
        color: #FFFFFF;
      }
    }

    .bt-item {
      width: 90%;
      height: 80rpx;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      border-radius: 40rpx;
      font-weight: normal;
      font-size: 30rpx;
      text-align: left;
      font-style: normal;
      text-transform: none;
      background: #AD2325;
      color: #FFFFFF;
    }
  }

}
</style>
